//
//  NEDRequestConfig.m
//  MoreCoin
//
//  Created by 林宁宁 on 2020/3/9.
//  Copyright © 2020 MoreCoin. All rights reserved.
//

#import "NEDRequestConfig.h"

@implementation NEDRequestConfig

-(instancetype)init{
    if(self = [super init]){
        self.requestSerializerType = YTKRequestSerializerTypeJSON;
        self.responseSerializerType = YTKResponseSerializerTypeJSON;
        
        self.retryDelayInterval = 10;
    }
    return self;
}

@end

@implementation NEDRequestUploaBean

- (instancetype)initWithData:(id)data name:(NSString *)name type:(NSString * _Nullable)type{
    self = [super init];
    if([data isKindOfClass:[UIImage class]]){
        self.fileImage = data;
    }else if([data isKindOfClass:[NSString class]]){
        self.filePath = data;
    }else if([data isKindOfClass:[NSData class]]){
        self.fileData = data;
    }
    self.fileName = name;
    self.fileType = type;
    return self;
}


-(NSString *)fileNameUpload{
    if([self.fileName containsString:@"."]){
        return self.fileName;
    }
    NSString * fileType = @"png";
    if([self.fileType containsString:@"/"]){
        fileType = [self.fileType componentsSeparatedByString:@"/"].lastObject;
    }
    return [NSString stringWithFormat:@"%@.%@",self.fileName,fileType];
}


@end
